'''
Created on Jun 28, 2011

@author: ioan
'''
import Model


class CompositeCommand(Model.iCommand):
    '''
    classdocs
    '''

    def __init__(self):
        '''
        Constructor
        '''
        self.mCommands = list()

    def addCommand(self, iCommand):
        '''
        Adds a command to the list
        '''
        self.mCommands.append(iCommand)

    def addComposite(self, iCommand):
        '''
        Adds a composite command to the list
        '''
        self.mCommands.append(iCommand)

    def remove(self, index):
        '''
        removes the command from the list
        '''
        self.mCommands.__delitem__(index)

    def execute(self):
        for item in self.mCommands:
            item.execute()

    def undo(self):
        for item in self.mCommands:
            item.undo()
